﻿/*
 * This software is the confidential and proprietary
 * information of NetBay
 * Such confidential information should not be disclosed
 * NetBay copyright(c) 2010
 */

#region Using
using System.ComponentModel.DataAnnotations;
using System.ServiceModel.DomainServices.Server;
using System.Runtime.Serialization;
#endregion


namespace NetBay.Core.BusinessEntities
{
    [DataContract]
    public class ItemRights : ReturnObject
    {
        private bool m_bCanModify;
        private bool m_bCanConsult;
        private Item m_oItem;

        [Association("Item", "Key", "ForeignKey")]
        [Include]
        [DataMember]
        public Item Item
        {
            get { return m_oItem; }
            set
            {
                value.ForeignKey = Key;
                m_oItem = value;
            }
        }

        /// <summary>
        /// rg_reorg in r_group is modification right
        /// </summary>
        [DataMember]
        public bool CanModify
        {
            get { return m_bCanModify; }
            set { m_bCanModify = value; }
        }
        /// <summary>
        /// rg_cons in r_group is consultation right
        /// </summary>
        [DataMember]
        public bool CanConsult
        {
            get { return m_bCanConsult; }
            set { m_bCanConsult = value; }
        }

        [DataMember]
        public bool CanVisualize { get; set; }

        [DataMember]
        public long AuthorizationId { get; set; }
    }

    public abstract class ItemRightsDer : ItemRights
    {
        public abstract void SetIemList();
    }
}
